package com.scut.fy.gateway.fegin;

import com.scut.fy.common.core.model.HttpResult;
import com.scut.fy.gateway.auth.filter.FeignInterceptor;
import com.scut.fy.gateway.fegin.fallback.FyAdminFeignFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

/**
 * TODO
 *
 * @author JY
 * @version 1.0
 * @date 2021/9/6
 */
@FeignClient(
        name = "fy-admin",
        configuration = FeignInterceptor.class,
        fallback = FyAdminFeignFallback.class)
public interface FyAdminFeign {

    /**
     * 通过用户名查询用户信息
     * @param userName
     * @return
     */
    @PostMapping("/sysRole/findByUserName")
    HttpResult<List<Map<String, Object>>> findRolesByUserName(@RequestParam("userName") String userName);

    /**
     * 通过用户id查询用户权限
     * @param userId
     * @return
     */
    @PostMapping("/sysRole/findByUserId")
    HttpResult<List<Map<String, Object>>> findRolesByUserId(long userId);

    /**
     * 通过用户ID查询用户信息
     * @param userId
     * @return
     */
    @PostMapping("/sysUser/findById")
    HttpResult<Map<String, Object>> findUserByUserId(@RequestParam("userId") long userId);

    /**
     * 通过用户名查询用户信息
     * @param userName
     * @return
     */
    @PostMapping("/sysUser/findByName")
    HttpResult<Map<String, Object>> findUserByUserName(@RequestParam("userName") String userName);
}
